{% extends "base.html" %}
{% import 'bootstrap/wtf.html' as wtf %}

{% block app_content %}
    <table>
        <tr valign="top">
            <td><img src="{{ user.avatar(128) }}"></td>
            <td>&emsp;</td>
            <td>
                <h1>{{ user.username }}</h1>
                {% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
                {% if user.last_seen %}<p>最近活动: {{ moment(user.last_seen).format('YYYY/M/D hh:mm') }}</p>{% endif %}
                <p>{{ user.followers.count() }} 粉丝, {{ user.followed.count() }} 关注.</p>
                {% if user == current_user %}
                <p><a href="{{ url_for('main.messages') }}">{{current_user.new_messages()}}条新消息</a></p>
                <p>{{user.email}}</p>
                <p><a href="{{ url_for('main.edit_profile') }}">修改</a></p>
                {% elif not current_user.is_following(user) %}
                <p>
                    <form action="{{ url_for('main.follow', username=user.username) }}" method="post">
                        {{ form.hidden_tag() }}
                        {{ form.submit(value='关注', class_='btn btn-default') }}
                    </form>
                </p>
                {% else %}
                <p>
                    <form action="{{ url_for('main.unfollow', username=user.username) }}" method="post">
                        {{ form.hidden_tag() }}
                        {{ form.submit(value='取关', class_='btn btn-default') }}
                    </form>
                </p>
                {% endif %}
            </td>
        </tr>
    </table>
    <hr>

    {% if user != current_user %}
    对&emsp;{{ user.username }}&emsp;说几句悄悄话吧~
    <br>
    <div class="row">
        <div class="col-md-4">
            {{ wtf.quick_form(form_msg, action=url_for('main.send_message',recipient=user.username), method="post") }}
        </div>
    </div>
    <br>
    {% endif %}

    {% for post in posts %}
        {% include '_post.html' %}
    {% endfor %}
    {% include '_paged.html' %}

{% endblock %}